<?
	$nik 	= $HTTP_GET_VARS['nik'];
	$show 	= $HTTP_GET_VARS['show'];
	$no		= $HTTP_GET_VARS['no'];
	include("var.php");
	include("config.php");
	include("../header.php");

	$a = mssql_query("SELECT NIK, Nama FROM Karyawan WHERE NIK='$nik'",$conn);
	$b = mssql_fetch_array($a);
	// untuk hak akses
	$spar = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='master_karyawan'",$conn);
	$rpar = mssql_fetch_array($spar);	

?>
<script type="text/javascript">
	function hapus(Cat,ID,NIK)
	{
		var ok = confirm("Apakah Anda yakin menghapus data tersebut ?");
		if(ok == true)
		{
			window.location.href="delete.php?cat="+ Cat +"&no="+ ID +"&nik="+ NIK +"";
		}
		else
		{
		}
	}

	function konfirm(Cat,ID,NIK)
	{
		var ok = confirm("Apakah Anda akan menyetujui data tersebut data tersebut ?");
		if(ok == true)
		{
			window.location.href="<?=$PHP_SELF?>?show=keluarga&appr=yes&cat2="+ Cat +"&no="+ ID +"&nik="+ NIK +"";
		}
		else
		{
		}
	}

</script>
<style type="text/css">
#navsite h5 {
 display: none;
 width: 900px; 
}

#navsite ul {
 padding: 3px 0;
 margin-left: 0;
 border-bottom: 1px solid #778;
 font: 12px verdana, sans-serif; 
 width: 900px; 
 }

#navsite ul li {
 list-style: none;
 margin: 0;
 display: inline; 
 padding-right:1px;
 }

#navsite ul li a {
 padding: 3px 0.5em;
 margin-left: 3px;
 border: 1px solid #778;
 border-bottom: none;
 background: #DDE;
 text-decoration: none; }

#navsite ul li a:link {
 color: #448; }

#navsite ul li a:visited {
 color: #667; 
}

#navsite ul li a:link-hover, #navsite ul li a:visited: hover {
 color: #000;
 background: #AAE;
 border-color: #227; }

#navsite ul li a:active {
 background: white;
 border-bottom: 1px solid white; 
 color:#FFFFFF;
 font-weight:bold;
 }
</style>
	<?
		if($show == "pendidikan"){
			echo'<table cellspacing="0">';
		}
		else{
			echo'<table style="position:relative; left:80px;" cellspacing="0" width="80%">';
		}
	?>
    <table width="100%">
	<tr>
	 <td width="20%" class="line_bottom">&nbsp;&nbsp;Detail Karyawan:</td>
	 <td class="line_bottom" align="left"><b><?=$b[Nama]?>/<?=$b[NIK]?></b></td>
	</tr>
	<?
	// data umum
	if($show == "data_umum"){
		$sql = "SELECT *, CONVERT(CHAR(12), tgl_lahir, 103) tanggal, B.nama agama, C.nama status FROM Karyawan A, VAgama B, VStatusKawin C WHERE NIK='$nik' AND B.kode=A.agama and C.kode=A.status";
		$query = mssql_query($sql,$conn);
		$row = mssql_fetch_array($query);
	?>
	<tr>
	 <td align="right" colspan="2" class="line_bottom"><a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> | 
     <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
     <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>"><b>Data Umum</b></a> |
    <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> |
    <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
    <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
    <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
    <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
    <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a>
	 </td>
	</tr>
	<tr>
	 <td colspan="2">&nbsp;</td>
	</tr>
    <tr>
     <td colspan="2">
     <table>
	 <tr>
      <td rowspan="18" width="120" valign="top" align="center">
      <?
      	if($row[Foto] == ""){
	  ?>
      	<img src="../file_photo/photo.gif" border="0" />
      <?
      	}
		else{
	  ?>
      	<img src="<?=$path?>/file_photo/<?=$row[Foto]?>" width="102" height="120" border="1" />
      <?
      	}
	  ?>
      </td>
	  <td width="150"><b>NIK</b></td>
	  <td>: <?=$row[NIK]?></td>
	 </tr>
	 <tr>
	  <td>Code Area</td>
	  <td>:	<?=$row[AreaCode]?></td>
	 </tr>
     <?
      if($row[pelamar] == 1 ){
	 ?>
	 <tr>
	  <td>Status Pelamar</td>
	  <td>:	Ya</td>
	 </tr>
     <?
	 }
     else{
	 	// command
	 }
	 ?>
	 <tr>
	  <td>Nama Lengkap</td>
	  <td>: <?=$row[Nama]?></td>
	 </tr>
	 <tr>
	  <td>Tempat, Tanggal Lahir</td>
	  <td>: <?=$row[TempatLahir]?>, <?=$row[tanggal]?></td>
	 </tr>
	 <tr>
	  <td>Status</td>
	  <td>: <?=$row[status]?></span>
	  </td>
	 </tr>
	 <tr>
	  <td>Gender</td>
	  <td>: 
	  <?
		if($row[JKel] == 0){
			echo"Pria";
		}
		else{
			echo"Wanita";
		}
	  ?>
	  </td>
	 </tr>
	 <tr>
	  <td>Agama</td>
	  <td>: <?=$row[agama]?>
	  </td>
	 </tr>
	 <tr valign="top">
	  <td valign="top">Alamat</td>
	  <td valign="top">: <?=$row[Alamat]?> 
	  </td>
	 </tr>
	 <tr>
	  <td>Kelurahan</td>
	  <td>: <?=$row[Kelurahan]?></td>
	 </tr>
	 <tr>
	  <td>Kecamatan</td>
	  <td>: <?=$row[Kecamatan]?></td>
	 </tr>
	 <tr>
	  <td>Kota</td>
	  <td>: <?=$row[Kota]?></td>
	 </tr>
	 <tr>
	  <td>Kode Pos</td>
	  <td>: <?=$row[KodePos]?></td>
	 </tr>
	 <tr>
	  <td>Propinsi</td>
	  <td>: <?=$row[Propinsi]?></td>
	 </tr>
	 <tr>
	  <td>Negara</td>
	  <td>: <?=$row[Negara]?></td>
	 </tr>
	 <tr>
	  <td>No. KTP</td>
	  <td>: <?=$row[NomorKTP]?></td>
	 </tr>
	 <tr>
	  <td>Telepon</td>
	  <td>: <?=$row[NoTelepon]?></td>
	 </tr>
	 <tr>
	  <td>Email</td>
	  <td>: <?=$row[Email]?></td>
	 </tr>
     </table>
     </td>
     </tr>
	 <tr>
	  <td>&nbsp;</td>
	  <td>
      <?
      // edit
	  if($rpar[edit] == 1){
	  ?>
      <input type="button" class="button" value="Edit" onClick="Javascript:location.href = '../form/frm_emp.php?op=edit&amp;nik=<?=$row[NIK]?>';" />
      <?
      }
	  ?>
      </td>
	 </tr>
	</table>
<?
}
elseif($show == "pendidikan"){

	// data pendidikan
	$sqlEdu	= "WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY Dari) AS no, B.keterangan, B.jurusan, NIK, NamaKampus, Tempat, No_Ijasah, IPK, CONVERT(CHAR(12), Dari, 103) tgl_dari, CONVERT(CHAR(12), Sampai, 103) tgl_sampai, CONVERT(CHAR(12), Tgl_Ijasah, 103) Tgl_Ijasah FROM Pendidikan A, MstPendidikan B WHERE NIK='$nik' AND A.Pend_ID=B.Pend_ID) SELECT * FROM limit ";
	$resEdu	= mssql_query($sqlEdu,$conn);
	$SqlEduCnt = mssql_num_rows($resEdu);
	//$rowEdu	= mssql_fetch_array($resEdu);
?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
    <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a>  |
    <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
    <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
    <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>"><b>Pendidikan</b></a> |
    <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
    <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
    <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
    <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
    <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
 </td>
</tr>
<tr>
 <td colspan="2" valign="top"><br />
  <i>&nbsp;&nbsp;<b>A. FORMAL</b></i><br /><br />
  <table border="0" cellpadding="1" cellspacing="1" width="100%">
	 <tr class="headlist">
	  <td>No.</td>
	  <td>Pendidikan</td>
	  <td>Kampus</td>
	  <td>Alamat</td>
	  <td>Dari</td>
	  <td>Sampai</td>
	  <td>No. Ijazah</td>
	  <td>Tanggal Ijazah</td>
	  <td>IPK</td>
	  <td colspan="2">&nbsp;</td>
	 </tr>
<?
	if($SqlEduCnt > 0){
		while($rowEdu	= mssql_fetch_array($resEdu)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowEdu[no]</td>
		  <td>$rowEdu[keterangan] - $rowEdu[jurusan]</td>
		  <td>$rowEdu[NamaKampus]</td>
		  <td>$rowEdu[Tempat]</td>
		  <td>$rowEdu[tgl_dari]</td>
		  <td>$rowEdu[tgl_sampai]</td>
		  <td>$rowEdu[No_Ijasah]</td>
		  <td>$rowEdu[Tgl_Ijasah]</td>	  	  	  	  	  	  
		  <td>$rowEdu[IPK]</td>
		  <td>";
		  // edit
		  if($rpar[edit] == 1){
		  echo"<a href='../form/frm_emp_pendidikan.php?op=edit&amp;nik=$rowEdu[NIK]&amp;no=$rowEdu[no]'><img src=../images/b_edit.png border=0 title=Edit alt=Edit></a>";
		  }
		  echo"</td><td>";
		  // hapus
		  if($rpar[hapus] == 1){
		  echo"<a href='#' onclick='hapus(\"".$show."\",\"".$rowEdu[no]."\",\"".$rowEdu[NIK]."\");'><img src=../images/b_delete.png border=0 title=Delete alt=Delete></a>";
		  }
		  echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     	// tambah
		if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_pendidikan.php?nik=<?=$nik?>';"  />
     <?
     	}
	 ?>
     </td>
	</tr>
   </table>
  </td>
 </tr>
 <tr>
  <td colspan="5"><hr noshade="noshade" size="-2" color="#EFEFEF" /></td>
 </tr>
 <tr>
  <td colspan="2"><br />
  <i>&nbsp;&nbsp;<b>B. INFORMAL</b></i><br /><br />
  <table border="0" cellpadding="1" cellspacing="1">
	 <tr class="headlist">
	  <td>No.</td>
	  <td>Jenis/Nama Training</td>
	  <td>Penyelenggara</td>
	  <td>Alamat</td>
	  <td>Dari</td>
	  <td>Sampai</td>
	  <td>No. Sertifikat</td>
	  <td>Tanggal Sertifikat</td>
	  <td>Jenis Sertifikat</td>
	  <td>Ikatan Dinas</td>
	  <td>Dari</td>
	  <td>Sampai</td>
	  <td colspan="2">&nbsp;</td>	  
	 </tr>
<?
// data kursus
	$sqlKur	 = mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, NIK, Program, Penyelenggara, Tempat, CONVERT(CHAR(12), Dari, 103) tgl_dari, CONVERT(CHAR(12), Sampai, 103) tgl_sampai, NoSertifikat, CONVERT(CHAR(12), TglSertifikat, 103) tgl_sertifikat, Jenis, IkatanDinas, CONVERT(CHAR(12), AwalIkatan, 103) awal_ikatan, CONVERT(CHAR(12), AkhirIkatan, 103) akhir_ikatan FROM KURSUS WHERE NIK='$nik') SELECT * FROM limit ",$conn);
	
	$sqlKurCnt = mssql_num_rows($sqlKur);
	if($sqlKurCnt > 0){
		while($rowKur	= mssql_fetch_array($sqlKur)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowKur[No]</td>
		  <td>$rowKur[Program]</td>
		  <td>$rowKur[Penyelenggara]</td>
		  <td>$rowKur[Tempat]</td>
		  <td>$rowKur[tgl_dari]</td>
		  <td>$rowKur[tgl_sampai]</td>
		  <td>$rowKur[NoSertifikat]</td>	  	  	  	  	  	  
		  <td>$rowKur[tgl_sertifikat]</td>";
		 
		$sqlVKur	= mssql_query("SELECT nama FROM VKursus WHERE kode='$rowKur[Jenis]'",$conn);	
		$rowVKur	= mssql_fetch_array($sqlVKur);
		echo" <td>$rowVKur[nama]</td>";
		echo"
		  <td>";
		
		if($rowKur[IkatanDinas] == 0){
			echo"Tidak";
		}
		elseif($rowKur[IkatanDinas] == 1){
			echo"Ya";
		}
		
		echo"</td>	  	  	  	  	  	  
		  <td>$rowKur[awal_ikatan]</td>
		  <td>$rowKur[akhir_ikatan]</td>
		  <td>";
		// edit
		if($rpar[edit] == 1){
		echo"<a href='../form/frm_emp_kursus.php?op=edit&amp;nik=$rowKur[NIK]&amp;no=$rowKur[No]'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"kursus\",\"".$rowKur[No]."\",\"".$rowKur[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else
	{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     	// tambah
		if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_kursus.php?nik=<?=$nik?>';"  />
     <?
     	}
	 ?>
     </td>
	</tr>
   </table>
  </td>
 </tr>
	<!---------- SERTIFIKASI ----------->
 <tr>
  <td colspan="2"><br />
  <i><b>&nbsp;&nbsp;C. SERTIFIKASI PROFESI</b> </i><br /><br />
  <table border="0" cellpadding="1" cellspacing="1" width="100%">
	 <tr class="headlist">
	  <td>No.</td>
	  <td>No. Sertifikat</td>
	  <td>Nama Sertifikat</td>
	  <td width="300">Deskripsi</td>
	  <td width="50">Tanggal Sertifikat</td>
	  <td width="50">Tanggal Kadaluwarsa<br />Sertifikat</td>
	  <td colspan="2">&nbsp;</td>	  
	 </tr>
<?
// data sertifikasi
	$sqlKur1	 = mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY Cert_Date) as No, *, year(Cert_Date) tahun_sertifikat, CONVERT(CHAR(12), Cert_Date, 103) tgl_sertifikat, CONVERT(CHAR(12), Cert_Date_Exp, 103) tgl_expire FROM MK_Certification WHERE NIK='$nik') SELECT * FROM limit ",$conn);
	//Cert_No,Cert_Name,Cert_Desc,Cert_Start,Cert_End,Cert_Date,Cert_Date_Exp
	$sqlKurCnt1 = mssql_num_rows($sqlKur1);
	if($sqlKurCnt1 > 0){
		while($rowKur1	= mssql_fetch_array($sqlKur1)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowKur1[No]</td>
		  <td>$rowKur1[Cert_No]</td>
		  <td>$rowKur1[Cert_Name]</td>
		  <td>$rowKur1[Cert_Desc]</td>
		  <td>$rowKur1[tgl_sertifikat]</td>
		  <td>$rowKur1[tgl_expire]</td>
		  <td width=10>";
		  //edit
		  if($rpar[edit] == 1){
		  echo"<a href='../form/frm_emp_certified.php?op=edit&amp;nik=$rowKur1[NIK]&amp;no=$rowKur1[No]'><img src=../images/b_edit.png border=0></a>";
		  }
		  echo"</td>
		  <td width=10>";
		  // hapus
		  if($rpar[hapus] == 1){
		  echo"<a href='#' onclick='hapus(\"certified\",\"".$rowKur1[No]."\",\"".$rowKur1[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		  }
		  echo"</td>
		 </tr>
		";
		} 
	}
	else
	{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     	// tambah
	 	if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_certified.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
   </table>
  </td>
 </tr>
<?
}
elseif($show == "keluarga"){

	if($HTTP_GET_VARS['appr'] == "yes" and $HTTP_GET_VARS['cat2'] == "appr_keluarga"){
//	echo $nik." ".$no;
	mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY Nm_Keluarga) as No, * FROM Keluarga A, MstData B, VPendidikan C WHERE NIK='$nik' AND B.GroupCode='hubungankeluarga' AND B.Code=A.Hubungan AND (A.TingkatPendidikan=C.kode)) UPDATE limit SET aktif='A' WHERE No='$no'",$conn);
	}
?>
<tr>
 <td align="right" valign="top" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>"><b>Keluarga</b></a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
 </td>
</tr>

<tr>
 <td width="100%" colspan="2" valign="top"><br />
  <table border="0" cellpadding="1" cellspacing="1" width="100%">
    <tr class="headlist">
	 <td>No.</td>
	 <td width="150">Nama</td>
	 <td>Hubungan</td>
	 <td>Jenis Kelamin</td>
	 <td>Tempat, Tanggal Lahir</td>
	 <td>Pendidikan</td>
	 <td>Pekerjaan</td>
	 <td>Alamat</td>
     <td>Approval Status</td>
	 <td colspan="2" width="50">&nbsp;</td>
	</tr>
<?
// untuk hak akses
	$spar = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='keluarga'",$conn);
	$rpar = mssql_fetch_array($spar);	
//	if($rpar[tambah] == 1){

// data keluarga
	$resKel	= mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY Nm_Keluarga) as No, NIK, Remarks, C.nama Pendidikan, Nm_Keluarga, JKel, A.TempatLahir, CONVERT(CHAR(21), Tgl_Lahir, 103) tgl_lahir, Pekerjaan, Alamat, A.aktif FROM Keluarga A, MstData B, VPendidikan C WHERE NIK='$nik' AND B.GroupCode='hubungankeluarga' AND B.Code=A.Hubungan AND (A.TingkatPendidikan=C.kode) ) SELECT * FROM limit ORDER BY No ASC",$conn);
	$SqlKelCnt = mssql_num_rows($resKel);
	if($SqlKelCnt > 0){
		while($rowKel	= mssql_fetch_array($resKel)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowKel[No]</td>
		  <td>$rowKel[Nm_Keluarga]</td>
		  <td>$rowKel[Remarks]</td>
		  <td>";
		if($rowKel[JKel] == "0"){
			echo"Pria";
		}
		elseif($rowKel[JKel] == "1"){
			echo"Wanita";
		}  
		echo"</td><td>$rowKel[TempatLahir], $rowKel[tgl_lahir]</td>
		  <td>$rowKel[Pendidikan]</td>
		  <td>$rowKel[Pekerjaan]</td>
		  <td>$rowKel[Alamat]</td>";
		 
		if($rowKel[aktif] == NULL || $rowKel[aktif] == 'A'){
		 	echo"
			<td style='color: blue' align=center>Data diterima</td>
			";
		}
		else{
		 	echo"
			<td style='color: red' align=center>Sedang dalam proses ...</td>
			";		 
		}
		echo"  
		  <td>";
		// approval
		if($rpar[approval] == 1){
			echo"<a href='#' onclick='konfirm(\"appr_keluarga\",\"".$rowKel[No]."\",\"".$rowKel[NIK]."\");'><img src='../images/apply.png' border=0 alt='Pertujuan/Approval' title='Persetujuan/Approval'></a>";
		}
		// edit
		if($rpar[edit] == 1){
		echo"
		  <a href='../form/frm_emp_family.php?nik=$rowKel[NIK]&amp;op=edit&amp;no=$rowKel[No]'><img src=../images/b_edit.png border=0></a>";
		}		
		echo"</td>
		  <td>";
		//hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"keluarga\",\"".$rowKel[No]."\",\"".$rowKel[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <input type="button" value="Refresh" class="button" onclick="Javascript:location.reload();" />
     <?
	if($rpar[tambah] == 1){     
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_family.php?nik=<?=$nik?>';"  />
     <?
     }
	 else{
	 }
	 ?>
     </td>
	</tr>
  </table>
 </td>
</tr>
<?
}
elseif($show=="karir"){
?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>"><b>Pengalaman</b></a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
</tr>
<tr>
 <td colspan="2"><br />
 <b>KARIR / PENGALAMAN KERJA</b>
  <table border="0" cellpadding="3" cellspacing="1" width="100%">
	 <tr class="headlist">
	  <td>No.</td>
	  <td>Nama Instansi</td>
	  <td>Jabatan</td>
	  <td>Scope of Works</td>
	  <td>Dari</td>
	  <td>Sampai</td>
	  <td>Gaji</td>
	  <td>Tunjangan</td>
	  <td>Alasan Berhenti</td>
	  <td colspan="2">&nbsp;</td>
	 </tr>
<?
// data pengalaman kerja
	$resPeng	= mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, NIK, instansi, jabatan, CONVERT(CHAR(12), dari, 103) tgl_dari, CONVERT(CHAR(12), sampai, 103) tgl_sampai, gaji, tunjangan, alasan, scope_of_works FROM Karir WHERE NIK='$nik' ",$conn);
	$SqlPengCnt = mssql_num_rows($resPeng);
	if($SqlPengCnt > 0){
		while($rowPeng	= mssql_fetch_array($resPeng)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowPeng[No]</td>
		  <td>$rowPeng[instansi]</td>
		  <td>$rowPeng[jabatan]</td>
		  <td>$rowPeng[scope_of_works]</td>
		  <td>$rowPeng[tgl_dari]</td>
		  <td>$rowPeng[tgl_sampai]</td>
		  <td align=right>Rp. ".number_format("$rowPeng[gaji]",",")."</td>
		  <td align=right>Rp. ".number_format("$rowPeng[tunjangan]",",")."</td>	  	  	  	  	  	  
		  <td>$rowPeng[alasan]</td>
		  <td>";
			// edit
		  if($rpar[edit] == 1){
		  echo"<a href='../form/frm_emp_karir.php?nik=".$rowPeng[NIK]."&amp;op=edit&amp;no=".$rowPeng[No]."'><img src=../images/b_edit.png border=0></a>";
		  }
		  echo"</td><td>";
			// delete
		  if($rpar[hapus] == 1){
		  echo"
		  <a href='#' onclick='hapus(\"".$show."\",\"".$rowPeng[No]."\",\"".$rowPeng[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		  }
		  echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     // tambah
	 if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_karir.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
   </table>
   </td>
   </tr>
   <tr>
    <td colspan="2"><hr noshade="noshade" size="-2" color="#999999" /></td>
   </tr>
   <tr>
    <td colspan="2">
	   <b>DATA NEGARA YANG PERNAH DIKUNJUNGI</b>
	   <table>
	    <tr class="headlist">
		 <td>No.</td>
		 <td>Negara</td>
		 <td>Dari</td>
		 <td>Mulai</td>
		 <td>Tujuan/Keterangan</td>
		 <td colspan="2">&nbsp;</td>
		</tr>
<?		
// data pengalaman luarnegeri
	$resLN	= mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, NIK, CONVERT(CHAR(12), Dari, 103) tgl_dari, CONVERT(CHAR(12), Sampai, 103) tgl_sampai, Country, Keterangan FROM PengalamanLN A, MstCountry B WHERE NIK='$nik' AND A.Negara=B.Code",$conn);
	$SqlLNCnt = mssql_num_rows($resLN);
	if($SqlLNCnt > 0){
		while($rowLN	= mssql_fetch_array($resLN)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowLN[No]</td>
		  <td>$rowLN[Country]</td>
		  <td>$rowLN[tgl_dari]</td>
		  <td>$rowLN[tgl_sampai]</td>
		  <td>$rowLN[Keterangan]</td>
		  <td>";
		// edit
		if($rpar[edit] == 1){
		echo"<a href='../form/frm_emp_pengalaman_ln.php?nik=".$rowLN[NIK]."&amp;op=edit&amp;no=".$rowLN[No]."'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"pengalamanLN\",\"".$rowLN[No]."\",\"".$rowLN[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>	
 	<tr>
	 <td colspan="10" align="left">
     <?
     // tambah
	 if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_pengalaman_ln.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
	   </table>
	</td>
   </tr>
   <tr>
    <td colspan="2"><hr noshade="noshade" size="-2" color="#999999" /></td>
   </tr>
   <tr>
    <td colspan="2">
	   <b>DATA REFERENSI/RELASI</b>
	   <table>
	    <tr class="headlist">
		 <td>No.</td>
		 <td>Nama</td>
		 <td>Alamat</td>
		 <td>No. Telepon</td>
		 <td>Jabatan</td>
		 <td>Hubungan</td>
		 <td colspan="2">&nbsp;</td>
		</tr>
<?		
// data pengalaman luarnegeri
	$resRef	= mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, * FROM PengalamanRef WHERE NIK='$nik') SELECT * FROM limit ORDER BY NIK ",$conn);
	$SqlRefCnt = mssql_num_rows($resRef);
	if($SqlRefCnt > 0){
		while($rowRef	= mssql_fetch_array($resRef)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowRef[No]</td>
		  <td>$rowRef[Nama]</td>
		  <td>$rowRef[Alamat]</td>
		  <td>$rowRef[NoTelp]</td>
		  <td>$rowRef[Jabatan]</td>
		  <td>$rowRef[Hubungan]</td>
		  <td>";
		// edit
		if($rpar[edit] == 1){  
		echo"<a href='../form/frm_emp_ref_pengalaman.php?nik=".$rowRef[NIK]."&amp;op=edit&amp;no=".$rowRef[No]."'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"pengalamanRef\",\"".$rowRef[No]."\",\"".$rowRef[NIK]."\");'><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>	
 	<tr>
	 <td colspan="10" align="left">
     <?
     	if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_ref_pengalaman.php?nik=<?=$nik?>';"  />
     <?
     	}
	 ?>
     </td>
	</tr>
	   </table>
	</td>
   </tr>
<?
}
elseif($show == "organisasi"){
?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>"><b>Organisasi</b></a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
 </td>
</tr>
<tr>
 <td colspan="2"><br />
  <i>PENGALAMAN BERORGANISASI</i><br /><br />
  <table border="0" cellpadding="1" cellspacing="1" width="100%" >
	 <tr class="headlist">
	  <td>No.</td>
	  <td>Nama Organisasi</td>
	  <td>Alamat</td>
	  <td>Jabatan</td>
	  <td width="50" colspan="2">&nbsp;</td>
	 </tr>
<?
// data organisasi
	$resOrg	= mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, * FROM Organisasi WHERE NIK='$nik' ",$conn);
	$SqlOrgCnt = mssql_num_rows($resOrg);
	if($SqlOrgCnt > 0){
		while($rowOrg	= mssql_fetch_array($resOrg)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowOrg[No]</td>
		  <td>$rowOrg[OrgName]</td>
		  <td>$rowOrg[OrgPlace]</td>
		  <td>$rowOrg[OrgTitle]</td>
		  <td>";
		// edit
		if($rpar[edit] == 1){  
		echo"<a href='../form/frm_emp_organisasi.php?op=edit&amp;nik=".$rowOrg[NIK]."&amp;no=".$rowOrg[No]."'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"".$show."\",\"".$rowOrg[No]."\",\"".$rowOrg[NIK]."\");' ><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
	 // tambah
     if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_organisasi.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
   </table>
   </td>
   </tr>
<?
}
elseif($show == "pribadi"){
		$sql = "SELECT * FROM Pribadi WHERE NIK='$nik'";
		$query = mssql_query($sql,$conn);
		$row = mssql_fetch_array($query);

?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>"><b>Data Pribadi</b></a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
 </td>
</tr>
<tr>
 <td colspan="2"><br />
<form name="FEmployee" method="post" action="<?=$Faction?>">
<table width="100%" class="no_border">
 <tr>
  <td width="30%"><b>NIK</b></td>
  <td>: <?=$row[NIK]?></td>
 </tr>
 <tr>
  <td>Nama Kampus</td>
  <td>: <?=$row[Nm_Kampus]?></td>
 </tr>
 <tr>
  <td>Fakultas</td>
  <td>: <?=$row[Fakultas]?></td>
 </tr>
 <tr>
  <td>Jenjang Pendidikan</td>
  <td>: <?
    	$sPa	= mssql_query("SELECT * FROM MstPendidikan Where Pend_ID='$row[Pend_ID]'",$conn);
		$rPa 	= mssql_fetch_array($sPa);
		echo"$rPa[keterangan] - $rPa[jurusan]";
		?>
</td>
 </tr>
 <tr>
  <td>Spesialisasi</td>
  <td>: <?=$row[Spesialisasi]?></td>
 </tr>
 <tr>
  <td>Keahlian</td>
  <td>: <?=$row[Keahlian]?></td>
 </tr>
 <tr>
  <td>Studi</td>
  <td>: <?=$row[Studi]?></td>
 </tr>
 <tr>
  <td>Tugas Akhir</td>
  <td>: <?=$row[TugasAkhir]?></td>
  <!--<span class="InfoForm">Format: dd/mm/yyyy</span>-->
  </td>
 </tr>
 <tr>
  <td>Tinggi</td>
  <td>: <?=$row[Tinggi]?> Cm, &nbsp;&nbsp;Berat Badan : <?=$row[Berat]?> Kg</td>
 </tr>
 <tr>
  <td>Hobby</td>
  <td align="left">: <?=$row[Hobby]?>  </td>
 </tr>
 <tr>
  <td>Olahraga</td>
  <td>: <?=$row[OlahRaga]?></td>
 </tr>
 <tr>
  <td>Pernah Sakit Keras</td>
  <td valign="middle">: 
  <?
  		if($row[SakitKeras] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
  </span> 
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Waktu Sakit: <?=$row[WaktuSakit]?> </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Nama Penyakit: <?=$row[NamaPenyakit]?></p>
   </td>
 </tr>
 <tr>
  <td>Pernah Kecelakaan</td>
  <td>:
  <?
  		if($row[Kecelakaan] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Waktu Kecelakaan : <?=$row[WaktuCelaka]?></p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Kecelakaan Apa : <?=$row[JenisCelaka]?></p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Akibat Kecelakaan : <?=$row[AkibatCelaka]?></p>
 <br />
   </td>
 </tr>
 <tr>
  <td>Pernah Terlibat Kegiatan Terlarang</td>
  <td>: 
  <?
  		if($row[Terlarang] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
 <tr>
  <td>Pernah Berurusan dengan Kepolisian</td>
  <td>: 
  <?
  		if($row[UrusanKepolisian] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;&nbsp;&nbsp;&nbsp;Penjelasan:<br />
  &nbsp;&nbsp;&nbsp;&nbsp; <?=$row[JenisUrusan]?>
  </td>
 </tr>
 <tr>
  <td>Pernah terdaftar program ASTEK</td>
  <td>: 
    <?
  		if($row[Astek] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>

  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;&nbsp;&nbsp;&nbsp;No. ASTEK : <?=$row[NoAstek]?>
  </td>
 </tr>
 <tr>
  <td>Pernah mengikuti Penataran P4</td>
  <td>: 
  <?
  		if($row[P4] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;&nbsp;&nbsp;&nbsp;Waktu Penataran: <br />
  &nbsp;&nbsp;&nbsp;&nbsp; <?=$row[WaktuP4]?>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td><p>&nbsp;&nbsp;&nbsp;&nbsp;Type Penataran:<br /> 
  &nbsp;&nbsp;&nbsp;&nbsp; <?=$row[TypeP4]?></p>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;&nbsp;&nbsp;&nbsp;Penyelenggara: <br />
  &nbsp;&nbsp;&nbsp;&nbsp; <?=$row[PenyelenggaraP4]?><br /><br />
  </td>
 </tr>
 <tr>
  <td>SIM</td>
  <td>: <?=$row[SIM]?>
  </td>
 </tr>
 <tr>
  <td>Tunjangan Sebelumnya</td>
  <td>: <?=$row[TunjanganSebelumnya]?>
  </td>
 </tr>
 <tr>
  <td>Gaji</td>
  <td>: <?=$row[Gaji]?>
  </td>
 </tr>
 <tr>
  <td valign="top">Bersedia ditempatkan dimana saja, diseluruh wilayah operasi perusahaan: <br><br><br></td>
  <td valign="top">:
  <?
  		if($row[SemuaWilayah] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
 <tr>
  <td valign="top">Bersedia mematuhi segala peraturan perusahaan yang berlaku, maupun keterangan lain yang akan ditambahkan</td>
  <td valign="top">: 
  <?
  		if($row[SemuaPeraturan] == 1){
			echo"Ya";
		}
		else{
			echo"Tidak";
		}
  ?>
  </td>
 </tr>
 <tr>
  <td valign="top">Keterangan</td>
  <td valign="top">: <?=$row[Keterangan]?>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="left"><br /><br />
  <input type="hidden" name="cat" value="pribadi" />
  <input type="hidden" name="nik" value="<?=$row[NIK]?>">
  <?
  	// edit
  	if($rpar[edit] == 1){
  ?>
  <input type="button" value="Edit" class="button" onClick="Javascript:location.href = '../form/frm_emp_pribadi.php?nik=<?=$nik?>';">
  <?
  }
  ?>
  <br /><br />
  </td>
 </tr>
</table>
</form>
</td>
</tr>
</table>
<script type="text/javascript">
//<![CDATA[

var f = document.forms[0];
/*MaskInput(f.elements[0], "(99)9999-9999");
MaskInput(f.elements[1], "99/99/9999");
MaskInput(f.elements[2], "Cc99-*C");
MaskInput(f.elements[3], "E^abc");
MaskInput(f.elements[4], "O^abc");
MaskInput(f.elements[5], "C^");
MaskInput(f.elements[6], "C^ ");
MaskInput(f.elements[7], "9^abc");
*/
<?
	//if($show == ""){
?>
//MaskInput(f.tinggi,"999");
<?
	//}
?>
//MaskInput(f.berat,"999");
//MaskInput(f.gaji,"999999999999999");
//MaskInput(f.tunjangan,"999999999999999");

//]]>
</script>
   </td>
   </tr>
<?
}
elseif($show == "kecakapan")
{
?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a>  |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>"><b>Kecakapan</b></a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a> 
  </td>
</tr>
<tr>
 <td colspan="2" height="100%"><br />
 <b>DATA BAHASA YANG DIKUASAI</b><br />
  <table border="0" cellpadding="1" cellspacing="1">
	 <tr class="headlist">
	  <td width="10">No.</td>
	  <td width="250">Bahasa</td>
	  <td colspan="2">&nbsp;</td>
	 </tr>
<?
// data bahasa yang dikuasai
	$resB	= mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) as No, * FROM Bahasa A, VBahasa B WHERE A.Bahasa=B.kode AND NIK='$nik' ",$conn);
	$SqlBCnt = mssql_num_rows($resB);
	if($SqlBCnt > 0){
		while($rowB	= mssql_fetch_array($resB)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowB[No]</td>
		  <td>$rowB[nama]</td>
		  <td>";
		// edit
		if($rpar[edit] == 1){
		echo"<a href='../form/frm_emp_bahasa.php?op=edit&amp;nik=".$rowB[NIK]."&amp;no=".$rowB[No]."'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rpar[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"".$show."\",\"".$rowB[No]."\",\"".$rowB[NIK]."\");' ><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     // tambah
	 if($rpar[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Tambah" onClick="Javascript:location.href = '../form/frm_emp_bahasa.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
   </table>
<?
}
// dokumen	
elseif($show == "dokumen"){
?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>">Status Pegawai</a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>"><b>Dokumen</b></a> 
  </td>
</tr>
<tr>
 <td colspan="2" height="100%"><br />
 <b>DOKUMEN PEGAWAI</b><br />
  <table border="0" cellpadding="1" cellspacing="1">
	 <tr class="headlist">
	  <td width="10">No.</td>
	  <td width="250">Nama Dokumen</td>
      <td width="250">File</td>
	  <td colspan="2">&nbsp;</td>
	 </tr>
<?
	// untuk hak akses
	// upload dokument
	$shdok = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='upload_document'",$conn);
	$rhdok = mssql_fetch_array($shdok);	
	// donwload dokument
	$sddok = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='download_document'",$conn);
	$rddok = mssql_fetch_array($sddok);	
// dokumen pegawai
	$resB	= mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, * FROM S_File_Emp WHERE NIK='$nik'",$conn);
	$SqlBCnt = mssql_num_rows($resB);
	if($SqlBCnt > 0){
		while($rowB	= mssql_fetch_array($resB)){
		echo"
		 <tr class=contentlist valign=top>
		  <td align=right>$rowB[No]</td>
		  <td>$rowB[nama_file]</td>
		  <td>";
		if($rddok[baca] == 1){
			echo"<a href='../dokumen/$rowB[filenya]' style='text-decoration:underline;'>$rowB[filenya]</a></td>";
		}
		else{
			echo"$rowB[filenya]</td>";
		}
		echo"<td>";
		// edit
		if($rhdok[edit] == 1){
		echo"<a href='../form/frm_upload_document.php?op=edit&amp;nik=".$rowB[NIK]."&amp;no=".$rowB[No]."'><img src=../images/b_edit.png border=0></a>";
		}
		echo"</td><td>";
		// hapus
		if($rhdok[hapus] == 1){
		echo"<a href='#' onclick='hapus(\"".$show."\",\"".$rowB[No]."\",\"".$rowB[NIK]."\");' ><img src=../images/b_delete.png border=0></a>";
		}
		echo"</td>
		 </tr>
		";
		} 
	}
	else{
		echo"<tr class=cell><td align=center colspan=20>--- TIDAK ADA DATA ---</td></tr>";
	}
?>
 	<tr>
	 <td colspan="10" align="left">
     <?
     // tambah
	 if($rhdok[tambah] == 1){
	 ?>
     <input type="button" class="button" value="Upload" onClick="Javascript:location.href = '../form/frm_upload_document.php?nik=<?=$nik?>';"  />
     <?
     }
	 ?>
     </td>
	</tr>
   </table>
<?
}
elseif($show == "status_karyawan"){
// get data from karir ptsi
$skarptsi = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='$nik'",$conn);
$rkarptsi = mssql_fetch_array($skarptsi);

?>
<tr>
 <td align="right" colspan="2" class="line_bottom">
		 <a href="<?=$PHP_SELF?>?show=status_karyawan&amp;nik=<?=$nik?>"><b>Status Pegawai</b></a> |
		 <a href="<?=$PHP_SELF?>?show=pribadi&amp;nik=<?=$nik?>">Data Pribadi</a> |
		 <a href="<?=$PHP_SELF?>?show=data_umum&amp;nik=<?=$nik?>">Data Umum</a> |
		 <a href="<?=$PHP_SELF?>?show=pendidikan&amp;nik=<?=$nik?>">Pendidikan</a> | 
		 <a href="<?=$PHP_SELF?>?show=kecakapan&amp;nik=<?=$nik?>">Kecakapan</a> |
		 <a href="<?=$PHP_SELF?>?show=keluarga&amp;nik=<?=$nik?>">Keluarga</a> |
		 <a href="<?=$PHP_SELF?>?show=karir&amp;nik=<?=$nik?>">Pengalaman</a> |
		 <a href="<?=$PHP_SELF?>?show=organisasi&amp;nik=<?=$nik?>">Organisasi</a> |
         <a href="<?=$PHP_SELF?>?show=dokumen&amp;nik=<?=$nik?>">Dokumen</a>
 </td>
</tr>
<tr>
 <td colspan="2">
<form name="FEmployee" method="post" action="<?=$Faction?>">
<table width="100%" class="no_border">
 <tr>
  <td width="25%">Direktorat</td>
  <td>: 
  <?
  	$kodeso = "$rkarptsi[kode_so2]";
	if(empty($kodeso)){
	
	}
	else{
    // direktorat
  	$uk = mssql_query("SELECT * FROM VLevelDirektorat WHERE substring(kode_so,1,2)='".substr($kodeso,0,2)."'",$conn);
	$rk	= mssql_fetch_array($uk);
	echo"$rk[uraian]";
	}
  ?>
  </td>
 </tr>
 <?
 	// koordinator
  	$uk2 	= mssql_query("SELECT * FROM VLevelKoordinator WHERE substring(kode_so,1,4)='".substr($kodeso,0,4)."'",$conn);
	$rk2	= mssql_fetch_array($uk2);	
	// biro/cabang
  	$uk3 	= mssql_query("SELECT * FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($kodeso,0,7)."'",$conn);
	$rk3	= mssql_fetch_array($uk3);	
	// bagian
  	$uk4 	= mssql_query("SELECT * FROM VLevelBagian WHERE substring(kode_so,1,10)='".substr($kodeso,0,10)."'",$conn);
	$rk4	= mssql_fetch_array($uk4);	
	// seksi
  	$uk5 	= mssql_query("SELECT * FROM VLevelSeksi WHERE substring(kode_so,1,12)='".substr($kodeso,0,12)."'",$conn);
	$rk5	= mssql_fetch_array($uk5);	
 ?>
 <!--
 <tr>
  <td>Koor. Teknis</td>
  <td>: <?$rk2[uraian]?></td>
 </tr>
 -->
 <tr>
  <td>Divisi/Biro/Cabang</td>
  <td>: <?=$rk3[uraian]?></td>
 </tr>
 <tr>
  <td>Bagian</td>
  <td>: <?=$rk4[uraian]?></td>
 </tr>
 <tr>
  <td>Seksi</td>
  <td>: <?=$rk5[uraian]?></td>
 </tr>
 <tr>
  <td>Lokasi</td>
  <td>: 
  <?
	$SSo = mssql_query("SELECT * FROM MstSO WHERE kode_so='".$kodeso."'",$conn);
	$SRo = mssql_fetch_array($SSo);
//  	echo"$SRo[0]";
	$sLk = mssql_query("SELECT * FROM MstLokasi WHERE kode_lokasi='".$SRo[kode_lokasi]."'",$conn);
	$rLk = mssql_fetch_array($sLk);
	echo"$rLk[distrik] - $rLk[propinsi]";
  ?>
  </td>
 </tr>
 <tr>
  <td>Jabatan</td>
  <td>:
   <?
   
	if(empty($rkarptsi[jabatan2])){
	}
	else{
	  	$jabatan = "$rkarptsi[jabatan2]";

   if(!empty($jabatan)){
   	$sJbS = mssql_query("SELECT * FROM MstJabatan WHERE kode='".$jabatan."'",$conn);
		if(mssql_num_rows($sJbS) > 0){
			$rJbS = mssql_fetch_array($sJbS);
			echo"$rJbS[jabatan]";
		}
		else{
		
		}
   }
   }
   ?>
  </td>
 </tr>
 <tr>
  <td>Fungsional</td>
  <td>: 
  <?
  
  //if(empty($rkarptsi[fungsi1])){
  	$fungsi = "$rkarptsi[fungsi2]";
  //}
  //else{
  	//$fungsi = "$rkarptsi[fungsi1]";
  //}
  if(empty($fungsi)){
  
  }
  else{
  	$sf = mssql_query("SELECT * FROM MstFungsional WHERE kode='$fungsi'");
	$rf = mssql_fetch_array($sf);
	echo"$rf[nama]";
  }
  
  ?></td>
 </tr>
 <tr>
  <td>Jabatan Rangkap:</td>
  <td>:
   <?
   
	$jabatan = "$rkarptsi[jabatan1]";

   if(empty($jabatan)){
   }
   else{
   	$sJb2 = mssql_query("SELECT * FROM MstJabatan WHERE kode='".$jabatan."'",$conn);
		if(mssql_num_rows($sJb2) > 0){
			$rJb2 = mssql_fetch_array($sJb2);
		}
		else{
		
		}
   }
   //}
	echo"$rJb2[jabatan]";
   ?>
  </td>
 </tr>
 <tr>
  <td>Golongan</td>
  <td>: <?=$rkarptsi[gol2]?></td>
 </tr>
 <tr>
  <td>Status Pegawai</td>
  <td>: 
  <?
  	$stat = "$rkarptsi[stat_kar2]";  
	if(empty($stat)){
	
	}
	else{
		$sk = mssql_query("SELECT * FROM VStatusKaryawan WHERE kode='$stat'",$conn);
		$rk = mssql_fetch_array($sk);
		echo"$rk[Nama]";
	}
  ?>
  </td>
 </tr>
 <tr>
  <td>Status Kerja</td>
  <td>: 
  <?
  /*
	$sjns = mssql_query("SELECT * FROM VJenisSurat WHERE IDCode='$rkarptsi[Jenis]'",$conn);
	if(mssql_num_rows($sjns) > 0){
		$rjns = mssql_fetch_array($sjns);
		if($rjns[Jenis] == "H" || $rjns[Jenis] == "U"){
			echo"BERHENTI";
		}
		else{
			echo"BEKERJA";
		}
	}
  */
	if($rkarptsi[Jenis] == "H" || $rkarptsi[Jenis] == "U"){
		echo"BERHENTI";
	}
	else{
		echo"BEKERJA";
	}
  ?>
  </td>
 </tr>
 <tr>
  <td>Pendidikan Terakhir</td>
  <td>:
  <?
  	// get pendidikan terakhir
	$slastpend = mssql_query("select A.*, B.Pend_ID, C.fakultas, C.jurusan from vreppendidikan A, Pendidikan B, MstPendidikan C WHERE A.NIK=B.NIK AND B.Pend_ID=C.Pend_ID AND A.NIK='$nik' AND C.keterangan=A.keterangan ORDER BY seqno desc ",$conn);
	if(mssql_num_rows($slastpend) > 0){
		$rlastpend = mssql_fetch_array($slastpend);
		echo"$rlastpend[keterangan], $rlastpend[jurusan]";
	}
  ?>
  </td>
 </tr>
 <tr>
  <td>Tanggal Masuk</td>
  <td>:
  <?
  	// tanggal masuk karyawan diambil dari karir ptsi pada urutan pertama
	// get data from karir ptsi
	$skarptsiA = mssql_query("SELECT CONVERT(CHAR(12), tgl_efektif, 103) TglEfektif FROM VKarirPtsi WHERE NIK='$nik' ORDER BY seqno ASC",$conn);
	$rkarptsiA = mssql_fetch_array($skarptsiA);
	echo"$rkarptsiA[TglEfektif]";
  ?>
  </td>
 </tr>
</table>
</form>
</td>
</tr>
</table>
 </td>
   </tr>
<?
}
?>
  </td>
</tr>
<tr>
 <td colspan="2"></td>
</tr>
</table>
</td>
</tr>
<?
echo"</div>
	  </td>
	   </tr>
	    </table>
";
include("../menu.php");
?>
